#!/bin/bash

ERRORLOG="/home/kelvin/error.log"
MAILADDRESS="kelvin@test.de"

# Die Groesse der Datei err.log wird ermittelt
if [ -e $ERRORLOG ]
then
	BYTECOUNT=$(du -k $ERRORLOG | cut -f1)
else
	BYTECOUNT=0
fi

if [ $BYTECOUNT -ne 0 ]
then
	# Die Datei err.log hat Inhalt und wird per mail verschickt und geloescht
	cat $ERRORLOG | mailx -s "Kelvin Error.log" $MAILADDRESS
	rm $ERRORLOG
fi
